#region "TypeExpando"

/*
 * ####     Developer Name : Wang Yucai
 * 
 * ####     Development Tool : Microsoft VisualStudio 2010 Ultimate Edition
 * 
 * ####     Create Time : 2014-07-08 15:41:08
 * 
 * ####     Namespace : Masterduner.SourceStudio.Practices.DevelopmentLibrary
 * 
 * ####     Type Name : TypeExpando
 * 
 * ####     Full Name : Masterduner.SourceStudio.Practices.DevelopmentLibrary.TypeExpando
 * 
 * ####     Machine Name : GLCHQWYCWINW7
 * 
 * ####     UserName : GUOCOLAND/wangyucai
 * 
 * ####     CLR Version : 4.0.30319.18444
 * 
 * ####     Target Framework Version : 4.0
 */

#endregion

using System;
using System.Reflection;

namespace Masterduner.SourceStudio.Practices.DevelopmentLibrary
{
    /// <summary>
    /// <para>Masterduner.SourceStudio.Practices.DevelopmentLibrary.TypeExpando</para>
    /// <para>
    /// 为<see cref="Type"/>提供的辅助性方法。
    /// </para>
    /// </summary>
    /// <remarks>
    /// <para>Target Framework Version : 4.0</para>
    /// </remarks>
    public static class TypeExpando
    {
        #region GetType
        /// <summary>
        /// 获取指定名称的类型。
        /// </summary>
        /// <param name="typeName">类型名称。</param>
        /// <returns><see cref="Type"/>对象实例。</returns>
        static public Type GetType(string typeName)
        {
            try
            {
                return Type.GetType(typeName, true);
            }
            catch (Exception ex)
            {
                throw new TypeNotFoundExceptionWrapper(typeName, ex);
            }
        }

        /// <summary>
        /// 从程序集<paramref name="assembly"/>中搜索名称为<paramref name="typeName"/>的类型。
        /// </summary>
        /// <param name="assembly"><see cref="Assembly"/>对象实例。</param>
        /// <param name="typeName">类型名称。</param>
        /// <returns><see cref="Type"/>对象实例。</returns>
        static public Type GetType(Assembly assembly, string typeName)
        {
            try
            {
                return assembly.GetType(typeName, true);
            }
            catch (Exception ex)
            {
                throw new TypeNotFoundExceptionWrapper(typeName, ex);
            }
        }
        #endregion
    }
}

#region README

/*
 * ####     ©2014 Wang Yucai
 * 
 * ####     Contact me
 *                  
 *                  E-mail : Masterduner@Yeah.net
 *                  Mobile : 13621384677
 *                  QQ : 180261899
 */

#endregion